package com.wk.springboot.httpUtils;

import java.io.InputStream;
import java.util.Map;

/**
 *
 */
public interface IHttpClient {

    /**
     * get 文本
     * @param url
     * @param contentType
     * @param urlParams
     * @return 文本
     * @throws DrspHttpException
     */
    public String get(String url, String contentType, Map<String, String> urlParams) throws DrspHttpException;

    /**
     * get 文本
     * @param url
     * @param contentType
     * @return 文本
     * @throws DrspHttpException
     */
    public String get(String url, String contentType) throws DrspHttpException;

    /**
     * post 文件，返回文本
     * 默认使用application/x-www-form-urlencoded
     * @param url  url
     * @param formParams 表单参数
     * @return
     * @throws DrspHttpException
     */
    public String postForm(String url, Map<String, String> formParams,
        Map<String, String> headerMap) throws DrspHttpException;

    /**
     * post 文件，返回文本
     * 默认使用application/x-www-form-urlencoded
     * @param url  url
     * @param formParams 表单参数
     * @return
     * @throws DrspHttpException
     */
    public String postForm(String url, Map<String, String> formParams) throws DrspHttpException;

    /**
     * post文件流
     * @param url
     * @param stream
     * @param headerMap
     * @return
     * @throws DrspHttpException
     */
    public String post(String url, InputStream stream, Map<String, String> headerMap) throws DrspHttpException;

    /**
     * post multipart
     * @param url url
     * @param entityBuilder  内容构建器
     * @param headerMap   header参数
     * @return  文本
     * @throws DrspHttpException
     */
    public String post(String url, MultipartEntityBuilderWraper entityBuilder,
        Map<String, String> headerMap) throws DrspHttpException;

    /**
     * post方式发送文本数据
     * @param url
     * @param contentType
     * @param headerMap header
     * @param body
     * @return 文本
     */
    public String post(String url, String contentType, String body, Map<String, String> headerMap) throws DrspHttpException;

    /**
     * post方式发送文本数据
     * contenttype 默认为  text/plain
     * @param url
     * @param body
     * @return 文本
     */
    public String post(String url, String body, Map<String, String> headerMap) throws DrspHttpException;

    /**
    * post方式发送文本数据
    * @param url
    * @param contentType
    * @param body
    * @return 文本
    */
    public String post(String url, String contentType, String body) throws DrspHttpException;

    public boolean getStream(String url, String contentType, Map<String, String> urlParams,
        IStreamExecutor executor) throws DrspHttpException;

    
    
    public void close();
}
